Código fuente de 'Concatena cadenas.asp'

<html>
<head>
<title>Concatena cadenas - Códigos asp, programacion asp, descargas asp, rutinas asp</title>
</head>
<p align="center"><b><font size="3">Concatena cadenas</font></b>
<body style="font-family: Arial; font-size: 9pt">
<br><br><br>
Se emplea la utilización de clases para acelerar (diez veces) la concatenación de cadenas, bastante lenta en ASP.
</p><br>
<!--
'ASP's ability to concatenating many strings together is really really slow by nature. 
'This sample code uses classes to speed up the process by ten times. 
'Someone recently came up with a DLL to do this but not all of us can install a DLL on our ISP's 
'web servers so I wrote this easy to use VB Class for handling string concatenation.
' Name: StrCat - Non DLL version
' By: Kevin Pirkl
' http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=6342&lngWId=4
-->     

<%   
    Set X = New strCat '- Create an instance of strCat
    X.Length = 100 '- Change from the default String length of 100,000
    str = "Hola mundo"
    For I = 1 To X.Length
    	X.Add("A") '- takes 7 seconds on my computer
    	'str = str & "A" '- takes 1 minute 7 seconds on my computer
    Next
    response.write str & "-" & X.value
    
    
   
    Set X = Nothing' Destroy the instance.
    response.write("<br>Se han concatenado las cadenas 'Hola mundo' Y 'A....A' ")
    
    
    Class strCat
    	Private IntCntr
    	Private strArray()
    	Private intLength
    	
    	Public Property Get Length
    		Length = intLength
    	End Property 
    	
    	
    	Public Property Let Length( ByVal intLen)
    		intLength = intLen
    		IntCntr = 0
    		Redim strArray(1)
    		strArray(0) = ""
    		Redim strArray(intLength)
    	End Property 
    	
    	
    	Public Property Get Value
    		Value = Join( strArray,"")
    	End Property 
    	
    	
    	Private Sub Class_Initialize()
    		IntCntr = 0
    		Length = 100000
    	End Sub
    	
    	
    	Public function Add( strToAdd)
    		strArray(IntCntr) = strToAdd
    		IntCntr = IntCntr + 1
    	End function
    End Class 

%>

</body></html>